package com.interview.strategy;

import com.interview.domain.OrderItem;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class NormalPricingStrategy extends PricingStrategy {
    @Override
    public OrderItem calculateCost(BigDecimal price, BigDecimal quantity, String title) {
        BigDecimal total = quantity.multiply(price).setScale(2,RoundingMode.UP);
        OrderItem orderItem = new OrderItem();
        orderItem.setDiscount(1.0);
        orderItem.setTotal(total);
        orderItem.setTitle(title);
        orderItem.setPrice(price.doubleValue());
        orderItem.setQuantity(quantity.doubleValue());
        return orderItem;
    }
}
